// c++中常用和不常用的关键字

#include <iostream>
#include <sophus/so3.hpp>
#include <vector>
#include <mutex>
#include <thread>
#include <unordered_map>

using namespace std;

typedef int junjie_int;
using junjie_float = float;
std::mutex mtx;

// 哈希表
std::unordered_map<int, int> junjie_map;


struct ListNode
{
    int value = 0;
    ListNode* next = nullptr;
    ListNode(): value(0),next(nullptr){ }
    ListNode(int a): value(a),next(nullptr){ }
    ListNode(int a, ListNode* b) : value(a),next(b){ }
};

struct point
{
public:
    Eigen::Vector3d point_ = Eigen::Vector3d::Zero();
private:
    double time = 0.0;
protected:
    junjie_float i = 0.0;
};

class cloud
{
private:
public:
    vector<point> cloud_;
    cloud(/* args */);
  
  ~cloud();

    // 虚函数
    virtual void fun1(){
        cout << "fun1" << endl;
    }

    virtual void fun2() = 0;
};

cloud::cloud(/* args */)
{

}

cloud::~cloud()
{
}


class junjie_cloud : public cloud
{
private:
    int number;

    /* data */
public:
    friend int get_num(junjie_cloud b);
    void set_num(int a);

    junjie_cloud(/* args */);
    ~junjie_cloud();
    virtual void fun1(){
        cout << "new fun1" << endl;
    }

    virtual void fun2(){
        cout << "new fun2" << endl;
    }

    inline bool aBigb(int a, int b){
        return a>b;
    }


};

void junjie_cloud::set_num(int a){
    number = a;
}

int get_num(junjie_cloud b){
    return b.number;
}

junjie_cloud::junjie_cloud(/* args */)
{
    cloud_.front().point_;
}

junjie_cloud::~junjie_cloud()
{
}

template<typename T>
void add(T a, T b){
    cout << "a : " << a << endl;
    cout << "b : " << b << endl;
}

template <> //函数模板特化
void add(int a, int b){
    cout << "a : " << a << endl;
    cout << "b : " << b << endl;
    cout << "a+b : " << a+b << endl;
}

void key_loop(){
    int i = 0;
    while(1){
        cout << "1111" << endl;
        i++;
        if(i > 10) break;
    }
}

int main(int argc, char* argv[]){
    junjie_cloud my_cloud;
    my_cloud.fun1();
    my_cloud.fun2();
    bool res = my_cloud.aBigb(1,2);
    cout << res << endl;

    my_cloud.set_num(10);
    cout << get_num(my_cloud) << endl;

    add(1,2);

    std::thread a(key_loop);
    // a.detach();
    a.join();

    std::cout << "ok" << std::endl;

    ListNode* junjie_a = new ListNode(1);

    int jun_1 = 10;
    int jun_2 = 20;

    junjie_map[jun_1] = jun_2;
    auto out  = junjie_map.find(jun_1);
    if(out != junjie_map.end()){
        cout << out->second << endl;
    }

    return 0;
}




/*
曲线拟合写一下
熟悉一下C++的关键字
然后是，链表的节点如何书写

然后开始熟悉项目内容和代码。

823 088 090
*/




